<?php
namespace app\login\validate;
use think\Validate;
class Admin extends Validate{
    protected $scene = [
        'login'=>['username','password','checkcode'],
    ];
    protected $rule = [
        'username'=>'require|length:5,20|alphaNum',//字母和数字
        'password'=>'require|length:5,20',
        // 'salt'=>'require|length:5|alphaNum',
        // 'nickname'=>'length:20|chsAlphaNum',//汉字、字母、数字
        // 'addtime'=>'number',
        // 'updatetime'=>'number',
        // 'logintime'=>'number',
        // 'loginip'=>'ip',
        // 'avatar'=>'length:100',
        // 'token'=>'alphaNum|length:60',
        // 'status'=>'number',
        'checkcode' => 'require|number|length:5|captcha', 
    ];
    protected $message  =   [
        'username.require' => '请输入用户名',
        'username.length' => '用户名必须5到20位',
        'username.alphaNum' => '用户名只能包含字母或数字',
        'password.require' => '请输入密码',
        'password.length' => '密码必须5到20位',
        'checkcode.require' => '请输入验证码',
        'checkcode.number' => '验证码只能包含数字',
        'checkcode.length' => '验证码必须5位',
        'checkcode.captcha' => '验证码错误❌',
    ];
}